Pen = cc.Node.extend({
		ctor:function(p){
			this._super();
			p.addChild(this, 10, TAG_PEN_NODE);
			this.loadpen();			
		},
		loadpen : function(){
			this.setCascadeOpacityEnabled(true);
			var pen= new Button(this, 30, TAG_PEN, "#pen0.png",this.callback);		
		},addlabel:function(obj,str,pos,time){
			var label = new cc.LabelTTF(str,gg.fontName,"20");
			label.setPosition(pos);
			label.setColor(cc.color(0,0,0));
			if(time==null){
				obj.addChild(label,5);
			}else{
				label.setOpacity(0);
				obj.addChild(label,5);
				label.runAction(cc.fadeIn(time));
			}

		},
		callback:function(p){
			var action = gg.flow.flow.action;
			var func = cc.callFunc(this.actionDone, this);	
			this.getParent().getChildByTag(TAG_CLOSE).setVisible(true);
			switch(p.getTag()){	
			case TAG_PEN:
				if(action==ACTION_DO1){
//					var pen2 = new cc.Sprite("#pen2.png");
//					pen2.setPosition(p.width,p.height*0.5-10);
//					p.addChild(pen2,1);
//
//					var move = cc.moveTo(1,cc.p(-40,180));
//					var rotate = cc.rotateTo(1,-20);
//					var spawn = cc.spawn(move,rotate);
//					var moveback= cc.moveTo(1,cc.p(0,0));
//					var rotate1 = cc.rotateTo(1,0);
//					var spawn1 = cc.spawn(moveback,rotate1);
//					var delay = cc.delayTime(0.5);
//
//
//					var seq = cc.sequence(spawn,delay,func,delay,spawn1,cc.callFunc(this.getParent().flowNext,this),cc.callFunc(function(){
//						pen2.removeFromParent();
//					},this));
//					p.runAction(seq);
					var window = new cc.Sprite("#lite.png");
					window.setPosition(600,400);
					window.setCascadeOpacityEnabled(true);
					this.getParent().addChild(window,80,TAG_BAOGAO);
					var baogao = new cc.Sprite("#baogao1.png");
					baogao.setPosition(window.width*0.5,window.height*0.5);
					window.addChild(baogao);
					this.addlabel(window,"25.00",cc.p(370,340));
					
				}
				if(action==ACTION_DO2){
//					var pen2 = new cc.Sprite("#pen2.png");
//					pen2.setPosition(p.width,p.height*0.5-10);
//					p.addChild(pen2,1);
//					var move = cc.moveTo(1,cc.p(-110,150));
//					var rotate = cc.rotateTo(1,-20);
//					var spawn = cc.spawn(move,rotate);
//					var moveback= cc.moveTo(1,cc.p(0,0));
//					var rotate1 = cc.rotateTo(1,0);
//					var spawn1 = cc.spawn(moveback,rotate1);
//					var delay = cc.delayTime(0.5);
//
//
//					var seq = cc.sequence(spawn,delay,func,delay,spawn1,cc.callFunc(this.getParent().flowNext,this),cc.callFunc(function(){
//						pen2.removeFromParent();
//					},this));
//
//					p.runAction(seq);
					var window =this.getParent().getChildByTag(TAG_BAOGAO);
					window.setVisible(true);
					this.addlabel(window,"0.00",cc.p(370,295));

				}
				if(action==ACTION_DO3){
//					var pen2 = new cc.Sprite("#pen2.png");
//					pen2.setPosition(p.width,p.height*0.5-10);
//					p.addChild(pen2,1);
//
//					var move = cc.moveTo(1,cc.p(-110,120));
//					var rotate = cc.rotateTo(1,-20);
//					var spawn = cc.spawn(move,rotate);
//					var moveto = cc.moveTo(1,cc.p(-60,90));
//
//					var movedown = cc.moveTo(1.5,cc.p(-50,30));
//					var moveback= cc.moveTo(1,cc.p(0,0));
//					var rotate1 = cc.rotateTo(1,0);
//					var spawn1 = cc.spawn(moveback,rotate1);
//					var delay = cc.delayTime(0.5);
//					var seq = cc.sequence(spawn,delay,func,delay,moveto,delay,movedown,delay,spawn1,
//							cc.callFunc(this.getParent().flowNext,this),cc.callFunc(function(){
//								pen2.removeFromParent();
//							},this));
//					p.runAction(seq);
					var window =this.getParent().getChildByTag(TAG_BAOGAO);
					window.setVisible(true);
					this.addlabel(window,"24.90",cc.p(370,255));
					this.addlabel(window,"25.10",cc.p(370,215),2);
					this.addlabel(window,"0.0996",cc.p(370,135),4);

				}
				if(action==ACTION_DO4){
					var window =this.getParent().getChildByTag(TAG_BAOGAO);
					window.setVisible(true);
					this.addlabel(window,"25.00",cc.p(550,340));//第二次
					this.addlabel(window,"0.00",cc.p(550,295));
					this.addlabel(window,"25.00",cc.p(550,255));
					this.addlabel(window,"25.00",cc.p(550,215),2);
					this.addlabel(window,"0.1000",cc.p(550,135),4);

					this.addlabel(window,"25.00",cc.p(710,340));//第三次
					this.addlabel(window,"0.00",cc.p(710,295));
					this.addlabel(window,"25.10",cc.p(710,255));
					this.addlabel(window,"24.90",cc.p(710,215),2);
					this.addlabel(window,"0.1004",cc.p(710,135),4);

					this.addlabel(window,"0.1000",cc.p(550,95),6);
					this.addlabel(window,"0.2667%",cc.p(550,50),6);
				}
				this.getParent().flowNext();
				break;
			}
		},
		actionDone:function(p){
			var action = gg.flow.flow.action;
			var func = cc.callFunc(this.actionDone, this);
			switch(p.getTag()){
			case TAG_PEN:
				if(action==ACTION_DO1){
//					var ziti = new cc.Sprite("#ziti/6.png");
//					ziti.setAnchorPoint(0,0.8);
//					ziti.setOpacity(0);
//					ziti.setPosition(cc.p(370,660));					
//					this.getParent().addChild(ziti);
//
//					var fadein = cc.fadeIn(0.5);
//					var seq = cc.sequence(fadein);
//					var yqhcl = this.getParent().getChildByTag(TAG_YQHCL);
//					var fade = cc.fadeTo(0.5,0);
//					yqhcl.runAction(fade);
//					ziti.runAction(seq);
//					break;

				}
				if(action==ACTION_DO2){
//					var ziti = new cc.Sprite("#ziti/9.png");
//					ziti.setAnchorPoint(0,0.8);
//					ziti.setOpacity(0);
//					ziti.setPosition(cc.p(370,630));					
//					this.getParent().addChild(ziti);
//
//					var fadein = cc.fadeIn(0.5);
//					var seq = cc.sequence(fadein);
//					var naohc = this.getParent().getChildByTag(TAG_NAOHC);
//					var fade = cc.fadeTo(0.5,0);
//					naohc.runAction(fade);
//					ziti.runAction(seq);
//					break;
				}
				if(action==ACTION_DO3){
//					var ziti = new cc.Sprite("#ziti/8.png");
//					ziti.setAnchorPoint(0,0.8);
//					ziti.setOpacity(0);
//					ziti.setPosition(cc.p(371,600));					
//					this.getParent().addChild(ziti);
//					var fadein = cc.fadeIn(0.5);
//					var seq = cc.sequence(fadein);
//
//					var naohz = this.getParent().getChildByTag(TAG_NAOHZ);
//					var fade = cc.fadeTo(0.5,0);
//
//					var delay1= cc.delayTime(1.5);
//					var ziti1 = new cc.Sprite("#ziti/0.png");
//					ziti1.setAnchorPoint(0,0.8);
//					ziti1.setOpacity(0);
//					ziti1.setPosition(cc.p(367,570));					
//					this.getParent().addChild(ziti1);
//					var fadein1 = cc.fadeIn(0.5);
//					var seq1 = cc.sequence(delay1,fadein1);
//
//					var naohx = this.getParent().getChildByTag(TAG_NAOHX);
//					var seq11 = cc.sequence(delay1,fade);
//
//					var delay2= cc.delayTime(3.5);
//					var ziti2 = new cc.Sprite("#ziti/3.png");
//					ziti2.setAnchorPoint(0,0.8);
//					ziti2.setOpacity(0);
//					ziti2.setPosition(cc.p(367,510));					
//					this.getParent().addChild(ziti2,11);
//					var fadein2 = cc.fadeIn(0.5);
//					var seq2 = cc.sequence(delay2,fadein2);
//
//					var chcl = this.getParent().getChildByTag(TAG_CHCL);
//					var seq22 = cc.sequence(delay2,fade);
//
//					naohz.runAction(fade);
//					ziti.runAction(seq);
//					naohx.runAction(seq11);
//					ziti1.runAction(seq1);
//					chcl.runAction(seq22);
//					ziti2.runAction(seq2);
//					break;
				}
				break;
			
			}
			}
	
});